#ifndef QOPENMESH_H
#define QOPENMESH_H

#include "QMesh_global.h"
#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
#include <QMap>
#include <QVector>
#include "qmesh.h"

typedef OpenMesh::PolyMesh_ArrayKernelT<> OMeshp;
typedef OpenMesh::TriMesh_ArrayKernelT<> OMesht;
typedef OMesht OMesh;

typedef OMesh::VertexIter VertexIter;
typedef OMesh::VertexHandle VH;
typedef OMesh::ConstFaceIter FaceIter;
typedef OpenMesh::PolyConnectivity::ConstFaceVertexIter fvI;


typedef QMap<int,int> IDMap;

class QMESHSHARED_EXPORT QOpenMesh: public QMesh
{
public:
    QOpenMesh();
    ~QOpenMesh();

    QOpenMesh(const QOpenMesh& rhs);

public:
    void LoadFromFile(char* filepath);
public:
	OMesh* GetMesh(){return &m_mesh;}

public:
    int nVertices();
    const float* Vertices();
    const float* Normals();
	
	uint* Indices();

public:
    uint UploadArrayData(int index);
    uint UploadElementData(int index);
    void BindArrayBuffer(int index, int programLocation);
    void DrawElements(int indicesIndex, GLenum mode);

public:
    void NormNoise(float mean, float std);

protected:
    OMesh m_mesh;
    QVector<uint> m_indices;
};

#endif // QOPENMESH_H
